﻿using Adnc.Infra.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace WYT.Ord.Repository.Entities
{
    /// <summary>
    /// 订单
    /// </summary>
    [Table("ord_order"),Comment("订单")]
    public class Order : EfEntity
    {
        /// <summary>
        /// 订单Code
        /// </summary>
        [Comment("订单编码"),MaxLength(50),Required()]
        public string Code { get;set;}

        /// <summary>
        /// 用户ID
        /// </summary>
        [Comment("用户ID")]
        public long UserId { get; set; }

        /// <summary>
        /// 用户账号
        /// </summary>
        [Comment("用户账号")]
        public int Account { get; set; }

        /// <summary>
        /// 推荐人
        /// </summary>
        [Comment("推荐人")]
        public long? Reference { get;set; }

        /// <summary>
        /// 收货人姓名
        /// </summary>
        [Comment("收货人姓名"),MaxLength(50)]
        public string? ConsigneeName { get; set; }

        /// <summary>
        /// 收货人电话
        /// </summary>
        [Comment("收货人电话"), MaxLength(20)]
        public string? ConsigneePhone { get; set; }

        /// <summary>
        /// 收货省
        /// </summary>
        [Comment("收货省"),MaxLength (50)]
        public string? ConsigneeProvince { get; set; }

        /// <summary>
        /// 收货市
        /// </summary>
        [Comment("收货市"), MaxLength(50)]
        public string? ConsigneeCity { get; set; }

        /// <summary>
        /// 收货区/县
        /// </summary>
        [Comment("收货区/县"), MaxLength(50)]
        public string? ConsigneeAreas { get; set; }

        /// <summary>
        /// 街道
        /// </summary>
        [Comment("街道"), MaxLength(50)]
        public string? ConsigneeStreet { get; set; }

        /// <summary>
        /// 详细地址
        /// </summary>
        [Comment("详细地址"),MaxLength(200)]
        public string? Address { get; set; }

        /// <summary>
        /// 总价
        /// </summary>
        [Comment("总价"), Column(TypeName = "decimal(18,2)")]
        public decimal Total { get; set; }

        /// <summary>
        /// 物流费用
        /// </summary>
        [Comment("物流费用"), Column(TypeName = "decimal(18,2)")]
        public decimal Postage { get; set; }

        /// <summary>
        /// 优惠金额
        /// </summary>
        [Comment("优惠金额"), Column(TypeName = "decimal(18,2)")]
        public decimal Discount { get; set; }

        /// <summary>
        /// 实际支付
        /// </summary>
        [Comment("实际支付"), Column(TypeName = "decimal(18,2)")]
        public decimal Payment { get; set; }

        /// <summary>
        /// 订单状态 -1：取消，1：待付款，2:待发货，3：待收货，4:已完成
        /// </summary>
        [Comment("订单状态 -1：取消，1：待付款，2:待发货，3：待收货，4:已完成")]
        public int State { get;set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Comment("创建时间")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 付款时间
        /// </summary>
        [Comment("支付时间")]
        public DateTime? PaymentTime { get;set;}

        /// <summary>
        /// 取消时间
        /// </summary>
        [Comment("取消时间")]
        public DateTime? CloseTime { get; set; }

        /// <summary>
        /// 发货时间
        /// </summary>
        [Comment("发货时间")]
        public DateTime? SendTime { get; set; }
        /// <summary>
        /// 收货时间
        /// </summary>
        [Comment("收货时间")]
        public DateTime? ConfirmTime { get; set; }

        /// <summary>
        /// 订单类型 1：常规订单,2：自提订单，3：线下开店进货单 4:线下升级订单
        /// </summary>
        [Comment("订单类型 1：常规订单,2：自提订单，3：线下开店进货单 4:线下升级订单")]
        public int OrderType { get; set; }

        /// <summary>
        /// 付款方式 1：微信 2：余额 3 购物金
        /// </summary>
        [Comment("付款方式1：微信 2：余额 3 购物金")]
        public int PayMode { get; set; }

        /// <summary>
        /// 应用类型 1：微信公众号 2：微信小程序 3：APP
        /// </summary>
        [Comment("应用类型 1：微信公众号 2：微信小程序 3：APP")]
        public int PayApp { get; set; }

        /// <summary>
        /// 镜像收货地址
        /// </summary>
        [Comment("镜像收货地址")]
        public string? ImagesAddress { get; set; }

        /// <summary>
        /// 买家留言
        /// </summary>
        [Comment("买家留言"),MaxLength(400)]
        public string? BuyerMessage { get; set; }

        /// <summary>
        /// 是否购买至云仓
        /// </summary>
        [Comment("是否购买至云仓")]
        public bool Warehouse { get; set; }

        /// <summary>
        /// 云仓库存类型 
        /// </summary>
        [Comment("云仓库存类型 0:常规 1:特殊")]
        public int? WarehouseType { get; set; }
    }
}
